Skip to content

Conversation

jeannotdamoiseaux
Copy link
Contributor

@jeannotdamoiseaux jeannotdamoiseaux commented Nov 29, 2024

Purpose

Currently, the send button is disabled when login is required, even if the user is already logged in (see #2071). While chatting can still be done via the Enter key, the disabled button is redundant since the text input box is already blocked when the user is not logged in. This unnecessary check has been removed to address this bug.

Does this introduce a breaking change?

When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.

[ ] Yes
[ X ] No

Does this require changes to learn.microsoft.com docs?

This repository is referenced by this tutorial
which includes deployment, settings and usage instructions. If text or screenshot need to change in the tutorial,
check the box below and notify the tutorial author. A Microsoft employee can do this for you if you're an external contributor.

[ ] Yes
[ X ] No

Type of change

[ X ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

Code quality checklist

See CONTRIBUTING.md for more details.

  • The current tests all pass (python -m pytest).
  • I added tests that prove my fix is effective or that my feature works
  • I ran python -m pytest --cov to verify 100% coverage of added lines
  • I ran python -m mypy to check for type errors
  • I either used the pre-commit hooks or ran ruff and black manually on my code.


const disableRequiredAccessControl = requireLogin && !loggedIn;
const sendQuestionDisabled = disabled || !question.trim() || requireLogin;
const sendQuestionDisabled = disabled || !question.trim();
Copy link
Collaborator

@pamelafox pamelafox Dec 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I wonder if it would make more sense to have || disableRequiredAccessControl? Would that also resolve the bug, since it should only be true when not logged in.

It's not a difference security-wise, since a logged out user will fail the authentication check on the server-side, but it'd make sense visually/for screen readers, I think.


const disableRequiredAccessControl = requireLogin && !loggedIn;
const sendQuestionDisabled = disabled || !question.trim() || requireLogin;
const sendQuestionDisabled = disabled || !question.trim() || disableRequiredAccessControl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added "disableRequiredAccessControl" to this boolean condition, to align the textfield and button disabled state.

@pamelafox pamelafox changed the title fix-send-button [Bugfix] The "send" button for chat should be enabled for logged in users Dec 2, 2024
@pamelafox pamelafox merged commit f00d36d into Azure-Samples:main Dec 2, 2024
10 checks passed
@jeannotdamoiseaux jeannotdamoiseaux deleted the fix-send-button branch December 4, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants